<?php

class Service {

  public function registerUser() {
    require_once './src/LoginClass.php';
    $login = new LoginClass();
    return $login->registerUser();
  }
  
  public function getLoginUrl() {
    require_once './src/LoginClass.php';
    $login = new LoginClass();
    return $login->getLoginUrl();
  }
//________________________________________________________________________VIDEOS
  public function getAllVideos($offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllVideos($offset, $limit);
  }
  
  public function getVideoById($id) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getVideoById($id);
  }
  
  public function getAllVideosByAlbumId($id) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllVideosByAlbumId($id);
  }
  
  public function getAllVideosByArtistId($id, $offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllVideosByArtistId($id, $offset, $limit);
  }
  
  public function getAllVideosByGenreId($id, $offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllVideosByGenreId($id, $offset, $limit);
  }
//________________________________________________________________________ALBUMS  
  public function getAllAlbums($offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllAlbums($offset, $limit);
  }
  
  public function getAlbumById($id) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAlbumById($id);
  }
  
  public function getAllAlbumsByVideoId($id) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllAlbumsByVideoId($id);
  }
  
  public function getAllAlbumsByArtistId($id, $offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllAlbumsByArtistId($id, $offset, $limit);
  }
  
  public function getAllAlbumsByGenreId($id, $offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllAlbumsByGenreId($id, $offset, $limit);
  }
//_______________________________________________________________________ARTISTS  
  public function getAllArtists($offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllArtists($offset, $limit);
  }
  
  public function getArtistById($id) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getArtistById($id);
  }
  
  public function getAllArtistsByVideoId($id) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllArtistsByVideoId($id);
  }
  
  public function getAllArtistsByAlbumId($id, $offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllArtistsByAlbumId($id, $offset, $limit);
  }
  
  public function getAllArtistsByGenreId($id, $offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllArtistsByGenreId($id, $offset, $limit);
  }
//________________________________________________________________________GENRES  
  public function getAllGenres($offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllGenres($offset, $limit);
  }
  
  public function getGenreById($id) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getGenreById($id);
  }
  
  public function getAllGenresByVideoId($id) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllGenresByVideoId($id);
  }
  
  public function getAllGenresByAlbumId ($id, $offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllGenresByAlbumId ($id, $offset, $limit);
  }
  
  public function getAllGenresByArtistId ($id, $offset, $limit) {
    require_once './src/DBClass.php';
    $db = new DBClass();
    return $db->getAllGenresByArtistId ($id, $offset, $limit);
  }
//__________________________________________________________________________TEST
  public function test() {
    require_once './src/DBClass.php';
    require_once './src/LoginClass.php';
    $db = new DBClass();
    $login = new LoginClass();
/*
    $logged = $login->isLogged();
    if (gettype($logged) <> "boolean"){
      return "ju";
    } else {
      return $logged->_explicitType;
    }
*/
//    return $db->isIdInDB(5);
    return $login->getUserId();
//    return $login->isLogged();
//    return $db->isIdInDB($login->getUserId());
  }
  
}

?>